import React, { Component } from "react";
import HeaderCss from "./index.module.css";

export default class Header extends Component {
  render() {
    return (
      <div>
        <input
          type="text"
          placeholder="请输入您的清单项，回车确认"
          className={HeaderCss.input}
          onKeyUp={(event) => {
            if (event.key === "Enter" && event.target.value) {
              this.props.add(event.target.value);
              event.target.value = "";
            }
          }}
        />
      </div>
    );
  }
}
